<template>
  <div>
    <el-menu @select="handleSelect" class="el-menu-demo" mode="horizontal">
      <el-submenu index="1">
        <template slot="title"
          >我的工作台
        </template>
        <el-menu-item index="1-1">退出</el-menu-item>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: "header_index",
  data() {
    return {
      activeIndex: 1
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      if ("1" === keyPath[0]) {
        if ("1-1" === keyPath[1]) {
          const _this = this;
          this.$util.messageBox({ msg: "确定退出？" }, function() {
            _this.$store.state.token = "";
            _this.$store.state.routerLength = 0;
            _this.$store.state.router = [];
            _this.$router.push({ path: "/login" });
          });
        }
      }
    }
  }
};
</script>

<style scoped></style>
